var e = require("../../../@babel/runtime/helpers/regeneratorRuntime"),
  t = require("../../../@babel/runtime/helpers/objectSpread2"),
  n = require("../../../@babel/runtime/helpers/slicedToArray"),
  o = require("../../../@babel/runtime/helpers/asyncToGenerator"),
  r = require("../../../config/index"),
  i = require("../../../store/index"),
  a = require("../../../utils/helper/common/index"),
  u = require("../../../utils/index").helper.share;
Page({
  componentPage: ["onPageScroll"],
  useStore: function (e) {
    return {
      isShowFreeInviteDialog: e.global.isShowFreeInviteDialog
    }
  },
  data: {
    content: ""
  },
  onLoad: function (e) {
    e.invite_code && (0, i.dispatch)(i.actions.storageActions.setItem({
      key: "INVITECODE",
      value: e.invite_code
    })), this.getDetailInfo(e)
  },
  getDetailInfo: function (i) {
    var a = this;
    return o(e().mark((function o() {
      var u, c, s, d, l, h;
      return e().wrap((function (e) {
        for (;;) switch (e.prev = e.next) {
          case 0:
            if (i.mode == r.typeMode.device && i.uuid) {
              e.next = 2;
              break
            }
            return e.abrupt("return");
          case 2:
            return e.next = 4, $.request["GET/business/excavator/detail/"+i.uuid]();
          case 4:
            u = e.sent, c = n(u, 1), 20002 === (s = c[0]).code ? (d = s.data,d.images=['https://excavator-container.oss-cn-hangzhou.aliyuncs.com/file/xjKWnIHDiUxLd623e9a7c9733df5d90e89ad26dd7f3a.jpg','https://excavator-container.oss-cn-hangzhou.aliyuncs.com/file/rrxZGmlpUDLQd623e9a7c9733df5d90e89ad26dd7f3a.jpg'], h = "联系老板",  a.setData({
              content: t(t({}, d), {}, {
                uuid: d.id,
              
              })
            })) : $.jxAlert({
              mode: "error",
              hideClose: !0,
              content: s.msg || "网络异常，请稍后再试"
            }).then((function () {
              $.router.back()
            }));
          case 8:
          case "end":
            return e.stop()
        }
      }), o)
    })))()
  },
  onCall: function () {
    var t = this;
    return o(e().mark((function n() {
      return e().wrap((function (e) {
        for (;;) switch (e.prev = e.next) {
          case 0:
            t.getPhone((function (e) {
              (0, a.callPhone)(e)
            }));
          case 1:
          case "end":
            return e.stop()
        }
      }), n)
    })))()
  },
  getPhone: function (t) {
    var n = this;
    return o(e().mark((function o() {
      var r, i, u;
      return e().wrap((function (e) {
        for (;;) switch (e.prev = e.next) {
          case 0:
            r = n.data.content, i = r.uuid, u = r.mode, (0, a.getPhone)({
              id: i,
              mode: u
            }).then((function (e) {
              if (200 == e.code) {
                var o = e.content;
                n.setData({
                  "content.getPhone": !0,
                  "content.callText": "免费拨打"
                }), t(o)
              }
            }));
          case 2:
          case "end":
            return e.stop()
        }
      }), o)
    })))()
  },
  onComplaint: function () {
    var e = this,
      t = this.data.content,
      n = t.is_report,
      o = t.getPhone,
      r = t.is_author,
      i = t.uuid,
      a = t.mode;
    r ? $.jxAlert({
      content: "您不能举报自己发布的信息"
    }) : n ? $.jxAlert({
      content: "您已经举报过这条信息了"
    }) : o ? $.router.push("/subpackage/common/complaint/index", {
      info: i,
      mode: a
    }) : $.jxAlert({
      mode: "warn",
      confirmText: "查看电话",
      content: "您还没查看电话号码，查看电话号码之后才能投诉。"
    }).then((function () {
      e.getPhone((function () {
        var t = e.data.content,
          n = t.uuid,
          o = t.mode;
        $.router.push("/subpackage/common/complaint/index", {
          info: n,
          mode: o
        })
      }))
    }))
  },
  onCloseInvite: function () {
    (0, i.dispatch)(i.actions.globalActions.setState({
      isShowFreeInviteDialog: !1
    }))
  },
  onShareAppMessage: function () {
    var e = this.data.content,
      t = e.title,
      n = e.images,
      o = e.uuid,
      r = e.mode;
    return u.getShareInfo(4, {
      title: t,
      imageUrl: null == n ? void 0 : n[0],
      params: {
        uuid: o,
        mode: r
      }
    })
  }
});